! MainWindow.f 
! Created 8/27/91 9:37 by AppMaker 

!!MP inlines.f
!!G JLtest.finc.f

!!D+
!!R+
!!OV+
!!S MainWindow 

!----------
	Subroutine OpenMainWindow (fName, vRefNum, fRefNum)
	include 'Globals.inc'
		String*255 fName
	integer*2 vRefNum, fRefNum
	pointer /grafport/ newWindow
	record /rect/ bounds

	newWindow = GetNewWindow (MainWindowID, nil, INT4(-1))
	Call SetWTitle (newWindow, %ref(fName))
	Call SetPort (newWindow)
	Call SetNewInfo (newWindow)
		cur^.vScroll.Ctlh = nil
		cur^.hScroll.Ctlh = nil
		cur^.fileNum	= fRefNum
		cur^.volNum	= vRefNum
		cur^.dirty	= .false.
		cur^.filename.shdl = NewString (%ref(fName))
		cur^.windowKind = WMainWindow 
				cur^.text.TEH	= nil
	!add code here: MainWindow open
	Call ShowWindow (newWindow)
	End !OpenMainWindow 

!----------
	Subroutine CloseMainWindow 
	include 'Globals.inc'

				Call DisposHandle (cur^.filename)
	Call DiscardInfo (curWindow)
	!add code here: MainWindow close
	End !CloseMainWindow 

!----------
	Subroutine MouseInMainWindow (where, modifiers)
	include 'Globals.inc'
	record /point/ where
	integer*2 modifiers
	record /rect/ bounds

		 
	!add code here: MainWindow mousedown
	End !MouseInMainWindow 

!----------
	Subroutine TypeInMainWindow(ch)
	include 'Globals.inc'
	Character*1 ch
		if (cur^.text.TEH = nil) then 
			Call SysBeep (INT2(1))
		else 
			Call TEKey (ch, cur^.text)
		end if
	!add code here: MainWindow keypress
	End !TypeInMainWindow 

!----------
	Subroutine UpdateMainWindow 
	include 'Globals.inc'
	record /rect/ bounds

				Call DrawClippedGrow (Int2(-15), Int2(-15))
	!add code here: MainWindow update 
	End !UpdateMainWindow 

!----------
	Subroutine ActivateMainWindow (activate)
	include 'globals.inc'
	logical activate
				Call DrawClippedGrow (Int2(-15), Int2(-15))
	!add code here: MainWindow activate 
	End !ActivateMainWindow 

!----------
	Subroutine ResizeMainWindow 
	include 'globals.inc'

	!add code here: MainWindow items resize 
	End !ResizeMainWindow 

!----------
	Subroutine ScrollMainWindow (newValue, oldValue)
	include 'globals.inc'
	integer*2 newValue, oldValue
	!add code here: MainWindow scroll 
	End !ScrollMainWindow 

!----------
	Subroutine ControlMainWindow (whichControl, whichPart, where)
	include 'globals.inc'
	record /ControlHandle/ whichControl
	Logical*2 TrackButton
	External TrackButton	
		integer*2 whichPart
	record /point/ where
	record /rect/ bounds

		End !ControlMainWindow 
